<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>浮动</title>
    <style>
      /* 使用浮动横向排列 */
      /* .one {
        width: 200px;
        height: 200px;
        background-color: brown;
        float: left;
      }
      .two {
        width: 100px;
        height: 100px;
        background-color: rgb(232, 195, 195);
        float: left;
      } */


      /* 使下面的盒子浮上来 */
      /* .three {
        width: 200px;
        height: 200px;
        background-color: brown;
      }
      .four {
        width: 100px;
        height: 100px;
        background-color: rgb(232, 195, 195);
        float: left;
        margin-top: -200px;
      } */



       /* 清除浮动 */
      .a{
        border:solid rosybrown ;
        /* 1.添加overflow属性方法 */
        /* overflow: auto;  */
        

      }
      /* 3.使用伪元素清除浮动 */
      /* .a::after{
        content: '';
        display: block;
        height: 0;
        clear: both;
        visibility: hidden;

      } */


      /* 4.使用双伪元素清除浮动 */
      /* .a::after,
      .a::before{
        content: "";
       display: table;
      }
      .a::after{
        clear: both;
      } */



      .a>span{
        background-color: blueviolet;
        float: left;
      }
      .a>div{
        background-color: cadetblue;
        float: right;

      }
      .b{
        background-color: cornflowerblue;
      } 








    </style>
  </head>
  <body>
    <!-- <div class="one"></div>
    <div class="two"></div>
    <div class="three"></div>
    <div class="four"></div> -->




    
    <div>
      <div class="a">
        <span>行内</span>
        <div>
          盒子
        </div>
        

      </div>
      <!-- 2.在浮动元素后添加一个空标签 
      <div style="clear:both"></div>-->
    <div class="b">
        盒子二号
      </div> 
    </div>
  </body>
</html>
